package per.ace.exception.common;

import lombok.Data;

/**
 * @program: springbootDemo
 * @description: 自定义异常类
 * @author: ace
 * @Date: 2020-08-06 13:41
 */
@Data
public class CMSException extends RuntimeException {

    private Integer code;

    public CMSException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public CMSException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMessage());
        this.code = resultCodeEnum.getCode();
    }

    @Override
    public String toString() {
        return "CMSException{" + "code=" + code + ", message=" + this.getMessage() + '}';
    }

}
